home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / s342q12.lha / clray.c < prev    next >
C/C++ Source or Header  |  1994-08-03  |  3KB  |  117 lines

  1. /**
  2. ***     This program allows inspection of the Citadel log
  3. ***     displaying misc things about the user.
  4. ***     Modified by H.A. White, May 2, 1984.
  5. ***     Modified by HAW Nov 2, 1988, to display net flags & copyright notice.
  6. **/
  7. #include "ctdl.h"    /* header file  */
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <stdlib.h>
  11. #include <math.h>
  12. #include <ctype.h>
  13. #include <time.h>
  14. #include <proto/exec.h>
  15. #include <dos/dos.h>
  16. #include <pragmas/dos_pragmas.h>
  17. #include "exec/memory.h"
  18. #include "exec/ports.h"
  19. #include "exec/exec.h"
  20.  
  21. #define LEGEND    "\nA indicates Aide\nE indicates Expert\n\
  22. N indicates Network Privileges\nD indicates Door Privileges\n\
  23. F indicates File Privileges\nP indicates Permanent Account\n\
  24. O indicates Floor Mode\nT indicates a Twit\nR indicates a Ruggie\n"
  25.  
  26. char dodebug;
  27. char doUsers;
  28.  
  29. #define TITLE   " CITADEL Log - Display User Utility   V3.42"
  30.  
  31. extern CONFIG    cfg;            /* A buncha variables           */
  32. extern LogTable    *logTab;        /* RAM index of pippuls         */
  33. extern logBuffer logBuf;         /* Pippul buffer                */
  34. extern FILE             *logfl;         /* log file descriptor          */
  35.  
  36. FILE *fopen();
  37. int showlog(int i, int x);
  38. int main(int, char **);
  39. int main(argc, argv)
  40. char **argv;
  41. int argc;
  42. {
  43.     int i, entry=0;
  44.     SYS_FILE fn;
  45.  
  46.     printf("%s\n%s\n\n", TITLE, COPYRIGHT);
  47.     dodebug = doUsers = FALSE;
  48.     while(--argc > 0 )
  49.       {
  50.       if( argv[argc][0] == '-' )
  51.         {
  52.         switch (argv[argc][1])
  53.           {
  54.           case 'd' :
  55.           case 'D' : dodebug = TRUE; break;
  56.           case 'u' :
  57.           case 'U' : doUsers = TRUE; break;
  58.           default  : printf(" Illegal option:%s\n",argv[argc]);
  59.           };
  60.         }
  61.       else printf(" Illegal argument:%s\n",argv[argc]);
  62.       };
  63.     cfg.weAre = UTILITY;
  64.     if (!readSysTab(FALSE, TRUE)) exit(1);
  65.     makeSysName(fn, "ctdllog.sys", &cfg.logArea);
  66.     if ((logfl = fopen(fn, "rb")) == NULL) {
  67.         printf("Sorry can't open the Citadel log!  Please inform the Sysop.\n");
  68.         exit(1);
  69.     }
  70.     initLogBuf(&logBuf);
  71.     for (i = 0; i < cfg.MAXLOGTAB; i++) {
  72.         if (logTab[i].ltpwhash != 0 &&
  73.             logTab[i].ltnmhash != 0) {
  74.             getLog(&logBuf,logTab[i].ltlogSlot);
  75.             if (showlog(entry, logTab[i].ltlogSlot)) entry++;
  76.         }
  77.     }
  78.     printf("\n\n%d valid entries.\n", entry);
  79.     if( doUsers )printf(LEGEND);
  80. return 0;
  81. }
  82.  
  83. int showlog(i,x)
  84. int i, x;
  85. {
  86.     char *LastOn(long lastdate, char s);
  87.  
  88.     if (logBuf.lbflags.L_INUSE)
  89.       {
  90.       if( doUsers ) printf("\nacct #%3d %4d:",x,i);
  91.       printf(" %-20s",logBuf.lbname);
  92.       if (dodebug) printf("%8ld", logBuf.lbvisit[0]);
  93.       if( doUsers )printf(" %d col. %c%c%c%c%c%c%c%c%c %s",
  94.             logBuf.lbwidth,
  95.             logBuf.lbflags.AIDE       ? 'A' : ' ',
  96.             logBuf.lbflags.EXPERT     ? 'E' : ' ',
  97.             logBuf.lbflags.NET_PRIVS  ? 'N' : ' ',
  98.             logBuf.lbflags.DOOR_PRIVS ? 'D' : ' ',
  99.             logBuf.lbflags.DL_PRIVS   ? 'F' : ' ',
  100.             logBuf.lbflags.PERMANENT  ? 'P' : ' ',
  101.       logBuf.lbflags.FLOORS     ? 'O' : ' ',
  102.       logBuf.lbflags.TWIT       ? 'T' : ' ',
  103.       logBuf.lbflags.RUGGIE     ? 'R' : ' ',
  104.             LastOn(logBuf.lblaston, TRUE));
  105.       if( (i % 3) == 2 && !doUsers )printf("\n");
  106.       return TRUE;
  107.     }
  108.     printf("\n");
  109.     return FALSE;
  110. }
  111.  
  112. void crashout(str)
  113. char *str;
  114. {
  115.     exit(printf(str));
  116. }
  117.